<div class="featuredRow">
  <div style="float:none">
    <dl>
      <dt class="tituloCurso">
      <% if @to_view[:type] == 'Assignment' %>
        <div id="tituloCursoT">Asignaci&oacute;n:</div><br />
      <% else %>
        <div id="tituloCursoT">Evento:</div>
		<br />
      <% end %>
      <div class="tituloTabla"><%=h @to_view.name %></div>
      <% if @to_view[:type] == 'Assignment' %>
        <span style="font-weight:bold">Ponderación: </span> <span style="text-align: right; font-weight: bold"><%= @to_view.weight %></span>
      <% end %>
      </dt><br/>

      <dd><span class="terminoCurso">Fecha de Inicio:</span> <%= date_spanish @to_view.due_date, true %></dd><br/>

      <dd><span class="terminoCurso">Fecha de Expiración:</span> <%= date_spanish @to_view.expire_date, true %></dd><br/>

      <% if @to_view.kind == 1 %>
        <dd><%= link_to 'Descargar descripcion', :action => :get, :id => @description %></dd><br />
      <% elsif @to_view.kind == 2 %>
        <dd><%=h @description.data %></dd><br />
      <% end %>

      <% if @to_view[:type] == "Assignment" %>
        <% if not is_student? %>
          <dd>
          Respuestas:
          <dl style="padding-left: 1em">
            <% for a in @to_view.assignment_answers %>
              <dt id="tituloCurso">
              <%= link_to h(a.user.login), :controller => :account, :action => :view, :id => a.user %>
              </dt>
              <dd>
              <%= link_to 'Ver respuesta', :controller => :event, :action => :get_answer, :id => a %>
              <% form_remote_tag :url => { :controller => 'event', :action => 'rate_answer', :id => a },
                                 :update => "status_#{a.id}" do %>
                <%= text_field_tag :grade, a.grade, :size => 3 %>
                <%= submit_tag 'Calificar' %>
                <span id="status_<%= a.id %>"></span>
              <% end %>
              </dd>
            <% end %>
          </dl>
          </dd>
        <% else %>
          <dd>
          <% if not @assignment_answer.nil? %>
            <dl style="padding-left: 1em">
              <div class="linkED"><%= link_to 'Ya diste una Respuesta', :controller => 'event', :action => 'get_answer', :id => @assignment_answer %></div>
              <br />
            </dl>
          <% end %>
          <% if Time.now < @to_view.expire_date and Time.now > @to_view.due_date %>
          <dl style="padding-left: 1em">
            <%= mensajes_de_error_para :assignment_answer, :answer_blob %><br/>
            <% form_tag(url_for({ :controller => 'event', :action => 'answer_assignment', :id => @to_view }), :multipart => true) do %>
              Tipo:<br/> <%= select(:assignment_answer, :kind, [[ "Texto plano", 2 ], ["Archivo", 1]] ) %><br/>
              <script language="javascript">
                function cambiar(){
                  if( $("assignment_answer_kind").selectedIndex == 0 ){
                    Effect.Fade('fileField');
                    $("tfF").disabled = true;
                    Effect.Appear('textArea');
                    $("taF").disabled = false;
                  }
                  else if( $("assignment_answer_kind").selectedIndex == 1 ){
                    Effect.Fade('textArea');
                    $("taF").disabled = true;
                    Effect.Appear('fileField');
                    $("tfF").disabled = false;
                  }
                }
                $('assignment_answer_kind').onchange = cambiar;
              </script>
			  <br />
              <div id="textArea">Respuesta: <br/><%= text_area :answer_blob, :data, :id => 'taF' %><br/></div>
              <div id="fileField" style="display: none">Respuesta: <br/><%= file_field :answer_blob, :data, :id => 'tfF' %></div>
              <script language="javascript">
                cambiar();
              </script>
			  <br />
              <%= submit_tag "Responder" %>
            <% end %>
			<br />
          </dl>
        <% end %>
      <% end %>
    <% end %>
    </dl>
  </div>
</div>
